/*
 * @(#)HandleEvent.java
 *
 * Copyright (c) 1996-2010 by the original authors of JHotDraw and all its
 * contributors. All rights reserved.
 *
 * You may not use, copy or modify this file, except in compliance with the 
 * license agreement you entered into with the copyright holders. For details
 * see accompanying license terms.
 */

package org.jhotdraw.draw.event;

import java.awt.Rectangle;
import java.util.EventObject;

import org.jhotdraw.draw.DrawingView;
import org.jhotdraw.draw.handle.Handle;

/**
 * An {@code EventObject} sent to {@link HandleListener}s.
 * 
 * <hr>
 * <b>Design Patterns</b>
 * 
 * <p>
 * <em>Observer</em><br>
 * State changes of handles can be observed by other objects. Specifically
 * {@code DrawingView} observes area invalidations and remove requests of
 * handles.<br>
 * Subject: {@link Handle}; Observer: {@link HandleListener}; Event:
 * {@link HandleEvent}; Concrete Observer: {@link DrawingView}.
 * <hr>
 * 
 * @author Werner Randelshofer
 * @version $Id: HandleEvent.java 717 2010-11-21 12:30:57Z rawcoder $
 */
public class HandleEvent extends EventObject {
	private Rectangle invalidatedArea;

	/** Creates a new instance. */
	public HandleEvent(Handle src, Rectangle invalidatedArea) {
		super(src);
		this.invalidatedArea = invalidatedArea;
	}

	public Handle getHandle() {
		return (Handle) getSource();
	}

	/**
	 * Gets the bounds of the invalidated area on the drawing view.
	 */
	public Rectangle getInvalidatedArea() {
		return invalidatedArea;
	}
}
